<template>
	<div id="app" >
		
		<!--<login v-if="loginshow"></login>-->
		
        <div class="layout">
            <Layout >
                <Header>
                    <div    style="background-color: #517EDB;">
            			<div style="text-align: center;height: 68px;background:rgba(49,98,201,1);width: 200px;">
                			<router-link to="/indexshow">
                				<img style="margin-top: 7px;width: 132px;height: 47px;" src="../../static/img/index_logo.png" alt="" />
                			</router-link>
                		</div>
                    	<div  style="position: absolute;left: 200px;top: 0px;">
                    		<span @click="moduleActiveChoose" v-for="(item,index) in moduleList" :key="index">
                    			<div style="cursor:pointer;" :value="item.value" v-bind:class="[moduleListActiveValue == item.value?moduleActive:'',moduleClass]"  >{{item.label}}</div>
                    		</span> 
		                </div>
                    	<!--<div style="top: 8px;right: 20px;position: absolute;line-height: 30px;color:rgba(255,255,255,1);width: 90px;text-align: center;">{{schoolName}}</div>-->
                    	<div style="top: 0px;right: 30px;position: absolute;cursor:pointer;">
	                        <Dropdown trigger="click" @on-click="personal">
						        <a href="javascript:void(0)">
						            <Avatar style="background-color: #57a3f3;margin-right: 10px;" icon="person" />
						        </a>
						        <DropdownMenu slot="list">
						            <DropdownItem name="personalcenter" >个人中心</DropdownItem>
						            <DropdownItem v-if="settingBarMenu" name="setting" >设置</DropdownItem>
						            <DropdownItem divided name="loginout">退出登录</DropdownItem>
						        </DropdownMenu>
						        <span>
						        	<span style="top: 8px;position: absolute;line-height: 30px;color:rgba(255,255,255,1);text-align: left; white-space: nowrap;text-overflow: ellipsis;width: 120px; display: inline-block;overflow: hidden;">{{schoolName}}</span>
						        	
						        	<span  style="color:rgba(255,255,255,1);line-height: 30px;top: 10px;position: relative;">{{username}}▼&nbsp;&nbsp;</span>
						        	<!--<span  style="color:rgba(255,255,255,1);line-height: 30px;top: 10px;position: relative;">|&nbsp;&nbsp; {{role}}▼</span>-->
						        </span>
						    </Dropdown>
						    <Dropdown trigger="click" @on-click="chooseRole">
						        <DropdownMenu slot="list">
						            <DropdownItem v-for="item in roleList" :selected='item.roleName == role? true:false' :key="item.roleId" :name="item.roleId" >{{item.roleName}}</DropdownItem>
						        </DropdownMenu>
						        <span>
						        	<span  style="color:rgba(255,255,255,1);line-height: 30px;top: 10px;position: relative;">|&nbsp;&nbsp; {{role}}▼</span>
						        </span>
						    </Dropdown>
					    </div>
                       
                    </div>
                </Header>
                <!--<Layout :style="{'width':'1400px','margin-left':'auto','margin-right':'auto'}">-->
                <Layout >
                    <Sider accordion v-show="toggle"  :style="{'min-height':'750px'}">
                        <Menu theme="dark" accordion ref="side_menu"  v-bind:active-name="activename" v-bind:open-names="opennames"  width="auto"  @on-select="routerlink" > 
							<!--<div v-if="item.hasOwnProperty('children')">-->
								<Submenu v-for="(item,index) in menu" :key="item.path" :name="item.path" >
				                    <template slot="title">
				                        <Icon style="margin-right: 0px;" :type="item.icon"></Icon>
				                       		<span style="font-size: 16px;display: inline-block;width: 100px;">{{item.name}}</span>
				                    </template>
				                    <MenuItem style="padding-left: 10px;" v-for="items in item.children" :key="items.path" :name="items.path">
				                    	{{items.name}}
				                    </MenuItem>
				                </Submenu>
				            <!--</div>-->
				            <!--<div v-else>
								<MenuItem :name="item.value">
									<span style="font-size: 16px;">
										{{item.name}}
									</span>
								</MenuItem>
                      		</div>-->
                        </Menu>
                    </Sider>
                    <div v-if="toggle">
                    	<!--<Icon style="font-size: 60px;" v-bind:style="toggleStyle" @click="toggleMenu"  type="iconfont alicon-suo1"></Icon>-->
                    	<img v-bind:style="toggleStyle" @click="toggleMenu" src="../../static/img/index_suo.png" alt="" />
                    </div>
                    <div v-else>
						<!--<Icon style="font-size: 60px;" v-bind:style="toggleStyle" @click="toggleMenu"  type="iconfont alicon-shen"></Icon>-->
						<img v-bind:style="toggleStyle" @click="toggleMenu" src="../../static/img/index_shen.png" alt="" />
					</div>
                    <Layout :style="{padding: '20px',background: '#ebedf0'}">
                        <Content :style="{padding: '0px', minHeight: '950px', background: '#fff'}">
                        	<!--<keep-alive include="['performancequery_keep_alive','ComprehensiveStatistics_high_keep_alive','ComprehensiveStatistics_middle_keep_alive']">
                            <router-view ></router-view>
                            </keep-alive>-->
                         	<keep-alive>
						     	<router-view v-if="$route.meta.keepAlive"></router-view>
						    </keep-alive>
						    <router-view v-if="!$route.meta.keepAlive"></router-view>
                        </Content>
                    </Layout>
                </Layout>
            </Layout>
			<Footer>
				<Row :style="{padding: '5px'}">
			        <Col span="10" offset="3">
			        		<div style="text-align: left;padding-top: 15px;">
								<img style="height:45px;" src="../../static/img/foottext.png" alt="" />
								<p style="color: white;">电话：0592-6257550&nbsp;&nbsp;|&nbsp;&nbsp;邮箱：hyjiaoyu@jx-hengyi.com</p>
								<p style="color: #999">备案号：闽IC备  16008713&nbsp;&nbsp;Copyright@2011-2018&nbsp;&nbsp;厦门市匠心恒一教育科技有限公司&nbsp;&nbsp;版权所有</p>
							</div>
			        </Col>
			        <Col span="7" offset="2">
			        	<div style="text-align: center;display: inline-block;">
			        		<img style="width:90px;" src="../../static/img/ewm.jpg"/>
			        		<p style="color: white;font-size: 12px;margin-left: -7px;">恒一微信号</p>
			        	</div>
			        	<div style="text-align: center;display: inline-block;margin-left: 15px;">
			        		<img style="width:90px;" src="../../static/img/ewm.jpg"/>
			        		<p style="color: white;font-size: 12px;margin-left: -7px;">微信公众号</p>
			        	</div>
			        </Col>
			    </Row>
				
			</Footer>
        </div>

    </div>
</template>

<script>
	import store from '@/store'
	import { mapState } from 'vuex'
	import { cleansessionstorage,getsessionstorage,setsessionstorage } from "@/components/js/Localstorage.js"
	import api from "@/components/js/Apidomain.js"
//	import {GetFunction} from '@/components/js/Permission.js'
    export default {
        name: 'App',
        data(){
        	return{
        		toggle:true,
        		activename:"/performance/statistics/statisticsmiddle",
        		opennames:['0'],
        		menu:[],
        		username:"",
        		schoolName:"",
        		role:"",			//中文名字
        		roleList:[],
        		
        		//header中的几个选项
        		moduleList: [],
                //header中的几个选项的选中状态
                moduleListActiveValue:"",
                //点击头像下拉菜单的设置按钮
                settingBarMenu:"",
        		
        		toggleStyle:{
        			position: 'absolute',
					top: '400px',
					left: '200px',
					cursor: 'pointer',
        		}
        	}
        },
        components:{
//      	login,
        },
        computed:{
        	...mapState([
        		"dyrouter"
        	]),
        	moduleClass:function(){
        		return 'moduleClass';
        	},
        	moduleActive:function(){
        		return 'moduleActive';
        	}
        	
        },
        created(){
        	this.referchangerouterlink();
        	this.slidemenu();
        	this.setusername();
        	this.getRoleList();
        },
        mounted(){
        	if(this.$route.path == '/index'){
        		this.$router.push('/indexshow')
        	}
            this.getTopmenuButton()
            //头部4个大模块刷新后校正
//          this.moduleListActiveValue = getsessionstorage('moduleListActiveValue')
        },
        methods:{
        	getRoleList:function(){
        		this.roleList = JSON.parse(getsessionstorage('userRoleList'))
        	},
        	//从sessionstorage获取页面顶部按钮和    设置   按钮是显示与否
			getTopmenuButton:function(){
				this.moduleList = JSON.parse(getsessionstorage('toolBarMenuInfo'));
				if(this.moduleList.length > 0){
					//console.log(this.moduleList[0].value)
					this.moduleListActiveValue = this.moduleList[0].value;
				}
				this.settingBarMenuInfo = JSON.parse(getsessionstorage('settingBarMenuInfo'))
				if(this.settingBarMenuInfo.length > 0){
					this.settingBarMenu = JSON.parse(getsessionstorage('settingBarMenuInfo'))[0].value;
					
				}
				//头部4个大模块刷新后校正
				if(getsessionstorage('moduleListActiveValue')){
					this.moduleListActiveValue = getsessionstorage('moduleListActiveValue')
				}
				//判断如果是在设置和个人中心则清空顶部选择的值
//				console.log(this.$route.path.indexOf("/personalcenter"))
				if(this.$route.path.indexOf("/personalcenter") > -1 || this.$route.path.indexOf("/basicsetting") > -1){
					this.moduleListActiveValue = getsessionstorage('moduleListActiveValue')
				}
			},
        	moduleActiveChoose:function(e){
        		let dom = e.target;
        		
        		//如果点到空白地方
        		if(dom.getAttribute("value") == null){
                    return;
               	}
        		//判断如果不是评价分析的栏目则显示正在开发中
//      		if(dom.innerText != "评价分析" && dom.innerText != "分析分析" && dom.innerText != "新高考"){
//      			this.$Message.error({
//		                content: "功能正在开发当中，敬请期待",
//		                duration: 5
//		            });
//		            return;
//      		}
                //获取绑定在dom上的数据
                var domvalue = dom.getAttribute("value");
                this.moduleListActiveValue = domvalue;
                //四大模块的激活的值保存到sessionstorage，用来页面刷新后校对
                setsessionstorage('moduleListActiveValue',domvalue);
                var sendData = {
    				"roleId":getsessionstorage('roleid'),
					"menuId":this.moduleListActiveValue
    			}
    			var self = this;
            	let url = api.apidomain+'/tqes/web/sysRes/getSideMenuInfo';
            	this.$http.post(url,sendData).then(function(response) {
					if(response.data.success == true){
//						//console.log(response.data.data.firstChildMenuPath)
//						//console.log(JSON.stringify(response.data.data.topMenuInfo))
						setsessionstorage('menuContainChild',JSON.stringify(response.data.data.menuContainChild));
						setsessionstorage('roleinfo',JSON.stringify(response.data.data.topMenuInfo));
//						if(dom.innerText == '评价分析'){
							store.dispatch('setdynamicrouter',null).then(()=>{
								self.$router.push(response.data.data.firstChildMenuPath)
							})
//						}
//						if(dom.innerText == '分析分析'){
//							store.dispatch('setdynamicrouter',null).then(()=>{
//								self.$router.push('/qualityAnalysis/dataanalyse/dataanalysemiddle')
//							})
//						}
//						if(dom.innerText == '新高考'){
//							store.dispatch('setdynamicrouter',null).then(()=>{
//								self.$router.push('/newHighTest/choosedataanalysis/combinationscore')
//							})
//						}
						
		          }else if(response.data.success == false){
				            self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});	
		            	}
		            	
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00279',
							duration: 10,
							closable: true
						});
					});
                
        	},
        	toggleMenu:function(){
        		if(this.toggle == true){
        			this.toggle = false;
        			this.toggleStyle.left = '0px';
        		}else{
        			this.toggle = true;
        			this.toggleStyle.left = '200px';
        		}
        		
        		this.$nextTick(function () {
			        var myEvent = new Event('resize');
        			window.dispatchEvent(myEvent);
			   	})
        		
        		
        	},
        	setusername:function(){
        		let username = getsessionstorage('username') 
        		let schoolName = getsessionstorage('schoolName') 
        		let role = getsessionstorage('role') 
        		if(username){ 
        			this.username = username;
        		}
        		if(username){ 
        			this.schoolName = schoolName;
        		}
        		
        		if(role){ 
        			this.role = role;
        		}
        		
        	},
			slidemenu:function(){
				
				let sildemenu = [];
//				//console.log(this.dyrouter)
				for(let key in this.dyrouter[0].children){
//					//console.log(this.dyrouter[0].children[key].name);
					if(/^[\u4e00-\u9fa5]/.test(this.dyrouter[0].children[key].name)){
						sildemenu.push(this.dyrouter[0].children[key])
					}
				}
//				//console.log(sildemenu)
				if(sildemenu.length != 0){
					for(let i = 0;i<sildemenu.length;i++){
						//基本设置
						if(sildemenu[i].path == "/basicsetting"){
							sildemenu[i].icon = "iconfont alicon-shezhi"
							sildemenu[i].children = [
		    											{name:"年级设置",path:"/basicsetting/grademanagement"},
									        			{name:"班级设置",path:"/basicsetting/classmanagement"},
									        			{name:"学生管理",path:"/basicsetting/studentmanagement"},
									        			{name:"教师管理",path:"/basicsetting/teachermanagement"},
													]
						} 
						if(sildemenu[i].path == "/setting/modulesetting"){
							sildemenu[i].icon = "iconfont alicon-shezhi"
							sildemenu[i].children = [
		    											{name:"教学评价",path:"/setting/modulesetting/teachingassessment"},
									        			{name:"原始分统计",path:"/setting/modulesetting/originalscorestatistics"},
									        			
													]
						} 
						if(sildemenu[i].path == "/setting/messagesetting"){
							sildemenu[i].icon = "iconfont alicon-shezhi"
							sildemenu[i].children = [
		    											{name:"自动短信",path:"/setting/messagesetting/automessage"},
									        			{name:"手动短信",path:"/setting/messagesetting/manualmessage"},
									        			
													]
						} 
						if(sildemenu[i].path == "/setting/systemhelp"){
							sildemenu[i].icon = "iconfont alicon-shezhi"
							sildemenu[i].children = [
		    											{name:"分类管理",path:"/setting/systemhelp/categorymanage"},
									        			{name:"帮助管理",path:"/setting/systemhelp/helpmanage"},
									        			
													]
						} 
						if(sildemenu[i].path == "/setting/systeminfo"){
							sildemenu[i].icon = "iconfont alicon-shezhi"
							sildemenu[i].children = [
		    											{name:"信息管理",path:"/setting/systeminfo/infomanage"},
									        			
													]
						} 
						if(sildemenu[i].path == "/personalcenter"){
							sildemenu[i].icon = "iconfont alicon-shezhi"
							sildemenu[i].children = [
		    											{name:"个人信息",path:"/personalcenter/personalinfo"},
									        			{name:"系统帮助",path:"/personalcenter/systemhelp"},
													]
						} 
						//1评价分析-大数据分析
						if(sildemenu[i].path == "/performance/statistics"){
							sildemenu[i].icon = "iconfont alicon-baobiaotongji"
						} 
						//1评价分析-评价计算
						if(sildemenu[i].path == "/performance/introductionscore"){
							sildemenu[i].icon = "iconfont alicon-jisuanqi"
						} 
						//1评价分析-评价查询
						if(sildemenu[i].path == "/performance/performancequery"){
							sildemenu[i].icon = "iconfont alicon-chaxun"
						} 
						//1评价分析-历史查询
						if(sildemenu[i].path == "/performance/historyquery"){
							sildemenu[i].icon = "iconfont alicon-chaxun"
						} 
						//2分析分析-大数据分析
						if(sildemenu[i].path == "/qualityAnalysis/dataanalyse"){
							sildemenu[i].icon = "iconfont alicon-baobiaotongji"
						} 
						//2分析分析-分析计算
						if(sildemenu[i].path == "/qualityAnalysis/masscalculation"){
							sildemenu[i].icon = "iconfont alicon-jisuanqi"
						} 
						//2分析分析-分析查询
						if(sildemenu[i].path == "/qualityAnalysis/qualityquery"){
							sildemenu[i].icon = "iconfont alicon-chaxun"
						} 
						//2分析分析-学生查询
						if(sildemenu[i].path == "/qualityAnalysis/studentinquiry"){
							sildemenu[i].icon = "iconfont alicon-chaxun"
						} 
						//3新高考-选科数据分析
						if(sildemenu[i].path == "/newhightest/choosedataanalysis"){
							sildemenu[i].icon = "iconfont alicon-chaxun"
						} 
						//3新高考-新高考选科
						if(sildemenu[i].path == "/newhightest/choosesubject"){
							sildemenu[i].icon = "iconfont alicon-chaxun"
						} 
						
						if(sildemenu[i].path == "/selectcourses/selectivesection"){
							sildemenu[i].icon = "iconfont alicon-chaxun"
						}
						if(sildemenu[i].path == "/selectcourses/hierarchicalscheduling"){
							sildemenu[i].icon = "iconfont alicon-chaxun"
						}
						if(sildemenu[i].path == "/selectcourses/coursesystem"){
							sildemenu[i].icon = "iconfont alicon-chaxun"
						}
						if(sildemenu[i].path == "/selectcourses/basicsetting"){
							sildemenu[i].icon = "iconfont alicon-chaxun"
						}
					}
				}
				if(sildemenu.length != 0){
					var menuContainChild = JSON.parse(getsessionstorage('menuContainChild'));
					for(let key in menuContainChild){
						for(let i = 0;i<sildemenu.length;i++){
							if(key == sildemenu[i].path){
								sildemenu[i].children = menuContainChild[key]
							}
						}
					}
				}
				
				this.menu = sildemenu;
//				console.log(sildemenu)
			},
            //页面刷新后调整正确的侧边栏选项
            referchangerouterlink:function(){
            	let avtivelink = this.$route.path;
//          	//console.log(avtivelink)
            	//设置
            	if(avtivelink.indexOf("grademanagement") >= 0){
            		this.activename = "/basicsetting/grademanagement"
	            	this.opennames = ["/basicsetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateOpened();
	            		this.$refs.side_menu.updateActiveName()
            		})
            	}
            	else if(avtivelink.indexOf("classmanagement") >= 0){
            		this.activename = "/basicsetting/classmanagement"
            		this.opennames = ["/basicsetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateOpened();
	            		this.$refs.side_menu.updateActiveName()
            		})
            	}
            	else if(avtivelink.indexOf("studentmanagement") >= 0){
            		this.activename = "/basicsetting/studentmanagement"
	            	this.opennames = ["/basicsetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateOpened();
	            		this.$refs.side_menu.updateActiveName()
            		})
            	}
            	else if(avtivelink.indexOf("teachermanagement") >= 0){
            		this.activename = "/basicsetting/teachermanagement"
            		this.opennames = ["/basicsetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateOpened();
	            		this.$refs.side_menu.updateActiveName()
            		})
            	}
            	
            	
            	else if(avtivelink.indexOf("teachingassessment") >= 0){
            		this.activename = "/setting/modulesetting/teachingassessment"
            		this.opennames = ["/setting/modulesetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateOpened();
	            		this.$refs.side_menu.updateActiveName()
            		})
            	}
            	else if(avtivelink.indexOf("originalscorestatistics") >= 0){
            		this.activename = "/setting/modulesetting/originalscorestatistics"
            		this.opennames = ["/setting/modulesetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateOpened();
	            		this.$refs.side_menu.updateActiveName()
            		})
            	}
            	
            	else if(avtivelink.indexOf("automessage") >= 0){
            		this.activename = "/setting/messagesetting/automessage"
            		this.opennames = ["/setting/messagesetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateOpened();
	            		this.$refs.side_menu.updateActiveName()
            		})
            	}
            	else if(avtivelink.indexOf("manualmessage") >= 0){
            		this.activename = "/setting/messagesetting/manualmessage"
            		this.opennames = ["/setting/messagesetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateOpened();
	            		this.$refs.side_menu.updateActiveName()
            		})
            	}
            	else if(avtivelink.indexOf("categorymanage") >= 0){
            		this.activename = "/setting/systemhelp/categorymanage"
            		this.opennames = ["/setting/systemhelp"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateOpened();
	            		this.$refs.side_menu.updateActiveName()
            		})
            	}
            	else if(avtivelink.indexOf("helpmanage") >= 0){
            		this.activename = "/setting/systemhelp/helpmanage"
            		this.opennames = ["/setting/systemhelp"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateOpened();
	            		this.$refs.side_menu.updateActiveName()
            		})
            	}
            	else if(avtivelink.indexOf("infomanage") >= 0){
            		this.activename = "/setting/systeminfo/infomanage"
            		this.opennames = ["/setting/systeminfo"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateOpened();
	            		this.$refs.side_menu.updateActiveName()
            		})
            	}
            	
            	//评价分析
            	else if(avtivelink.indexOf("statisticsmiddle") >= 0){
            		
            		this.activename = "/performance/statistics/statisticsmiddle";
            		this.opennames = ["/performance/statistics"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("statisticshigh") >= 0){
            		this.activename = "/performance/statistics/statisticshigh"
	            	this.opennames = ["/performance/statistics"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("introductionscorehigh") >= 0){
            		this.activename = "/performance/introductionscore/introductionscorehigh"
	            	this.opennames = ["/performance/introductionscore"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("introductionscoremiddle") >= 0){
            		this.activename = "/performance/introductionscore/introductionscoremiddle"
	            	this.opennames = ["/performance/introductionscore"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("performancequeryhigh") >= 0){
            		this.activename = "/performance/performancequery/performancequeryhigh"
	            	this.opennames = ["/performance/performancequery"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("performancequerymiddle") >= 0){
            		this.activename = "/performance/performancequery/performancequerymiddle"
	            	this.opennames = ["/performance/performancequery"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}else if(avtivelink.indexOf("historyqueryhigh") >= 0){
            		this.activename = "/performance/historyquery/historyqueryhigh"
	            	this.opennames = ["/performance/historyquery"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}else if(avtivelink.indexOf("historyquerymiddle") >= 0){
            		this.activename = "/performance/historyquery/historyquerymiddle"
	            	this.opennames = ["/performance/historyquery"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	//分析分析
            	else if(avtivelink.indexOf("dataanalysehigh") >= 0){
            		this.activename = "/qualityAnalysis/dataanalyse/dataanalysehigh"
	            	this.opennames = ["/qualityAnalysis/dataanalyse"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("dataanalysemiddle") >= 0){
            		this.activename = "/qualityAnalysis/dataanalyse/dataanalysemiddle"
	            	this.opennames = ["/qualityAnalysis/dataanalyse"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("masscalculationhigh") >= 0){
            		this.activename = "/qualityAnalysis/masscalculation/masscalculationhigh"
	            	this.opennames = ["/qualityAnalysis/masscalculation"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("masscalculationmiddle") >= 0){
            		this.activename = "/qualityAnalysis/masscalculation/masscalculationmiddle"
	            	this.opennames = ["/qualityAnalysis/masscalculation"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("qualityqueryhigh") >= 0){
            		this.activename = "/qualityAnalysis/qualityquery/qualityqueryhigh"
	            	this.opennames = ["/qualityAnalysis/qualityquery"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("qualityquerymiddle") >= 0){
            		this.activename = "/qualityAnalysis/qualityquery/qualityquerymiddle"
	            	this.opennames = ["/qualityAnalysis/qualityquery"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("scorereport") >= 0){
            		this.activename = "/qualityAnalysis/studentinquiry/scorereport"
	            	this.opennames = ["/qualityAnalysis/studentinquiry"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	//新高考
            	else if(avtivelink.indexOf("combinationscore") >= 0){
            		this.activename = "/newhightest/choosedataanalysis/combinationscore"
	            	this.opennames = ["/newhightest/choosedataanalysis"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("studentchoosesubject") >= 0){
            		this.activename = "/newhightest/choosesubject/studentchoosesubject"
	            	this.opennames = ["/newhightest/choosesubject"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("subjectstatistics") >= 0){
            		this.activename = "/newhightest/choosesubject/subjectstatistics"
	            	this.opennames = ["/newhightest/choosesubject"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	
            	//-------------------
            	else if(avtivelink.indexOf("selectionmanagement") >= 0){
            		this.activename = "/selectcourses/selectivesection/selectionmanagement"
	            	this.opennames = ["/selectcourses/selectivesection"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("studentselection") >= 0){
            		this.activename = "/selectcourses/selectivesection/studentselection"
	            	this.opennames = ["/selectcourses/selectivesection"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	
            	
            	else if(avtivelink.indexOf("hierarchicalnamemanagement") >= 0){
            		this.activename = "/selectcourses/hierarchicalscheduling/hierarchicalnamemanagement"
	            	this.opennames = ["/selectcourses/hierarchicalscheduling"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("achievementintroduction") >= 0){
            		this.activename = "/selectcourses/hierarchicalscheduling/achievementintroduction"
	            	this.opennames = ["/selectcourses/hierarchicalscheduling"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("laminationmanagement") >= 0){
            		this.activename = "/selectcourses/hierarchicalscheduling/laminationmanagement"
	            	this.opennames = ["/selectcourses/hierarchicalscheduling"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("divisionresult") >= 0){
            		this.activename = "/selectcourses/hierarchicalscheduling/divisionresult"
	            	this.opennames = ["/selectcourses/hierarchicalscheduling"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	
            	else if(avtivelink.indexOf("curriculumrules") >= 0){
            		this.activename = "/selectcourses/coursesystem/curriculumrules"
	            	this.opennames = ["/selectcourses/coursesystem"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("schedulerules") >= 0){
            		this.activename = "/selectcourses/coursesystem/schedulerules"
	            	this.opennames = ["/selectcourses/coursesystem"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("teacherrules") >= 0){
            		this.activename = "/selectcourses/coursesystem/teacherrules"
	            	this.opennames = ["/selectcourses/coursesystem"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	//--------------
            	
            	
            	
            	else if(avtivelink.indexOf("classesgroup") >= 0){
            		this.activename = "/selectcourses/basicsetting/classesgroup"
	            	this.opennames = ["/selectcourses/basicsetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("classhours") >= 0){
            		this.activename = "/selectcourses/basicsetting/classhours"
	            	this.opennames = ["/selectcourses/basicsetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("coursesetting") >= 0){
            		this.activename = "/selectcourses/basicsetting/coursesetting"
	            	this.opennames = ["/selectcourses/basicsetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("curriculumarrangement") >= 0){
            		this.activename = "/selectcourses/basicsetting/curriculumarrangement"
	            	this.opennames = ["/selectcourses/basicsetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("teachgroup") >= 0){
            		this.activename = "/selectcourses/basicsetting/teachgroup"
	            	this.opennames = ["/selectcourses/basicsetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("teachroomsetting") >= 0){
            		this.activename = "/selectcourses/basicsetting/teachroomsetting"
	            	this.opennames = ["/selectcourses/basicsetting"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	
            	
            	//--------------
            	else if(avtivelink.indexOf("personalinfo") >= 0){
            		this.activename = "/personalcenter/personalinfo"
	            	this.opennames = ["/personalcenter"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	else if(avtivelink.indexOf("systemhelp") >= 0){
            		this.activename = "/personalcenter/systemhelp"
	            	this.opennames = ["/personalcenter"];
            		this.$nextTick(function () {
	            		this.$refs.side_menu.updateActiveName()
	            		this.$refs.side_menu.updateOpened();
            		})
            	}
            	
            	
            	else{
            		this.activename = ""
            	}
            },
            //点击侧边栏页面跳转的方法
        	routerlink:function(value){
        		this.$router.push(value)
        	},
        	personal:function(name){
        		if(name == 'loginout'){
        			this.$Message.loading({
		                    content: '正在退出中',
		                    duration: 0
		                });
        			var self = this;
	            	let url = api.apidomain+'/tqes/web/login/exit';
	            	this.$http.post(url).then(function(response) {
						if(response.data.success == true){
							self.$Message.destroy();
							self.$Message.success('退出成功');
							cleansessionstorage();
        					self.$router.push('/login')
			            }else if(response.data.success == false){
			            		self.$Message.destroy();
			            		self.$Message.error({
									content: response.data.msg,
									duration: 10,
									closable: true
								});	
			            	}
			            	
						})
						.catch(function(error) {
							self.$Message.destroy();
							self.$Message.error({
								content: '系统发生错误：错误码00280',
								duration: 10,
								closable: true
							});
						});
        			
        			
        		}else if(name == "personalcenter"){
//      			//console.log("个人中心")
//      			this.$router.push('/personalcenter')
        			
        			setsessionstorage('roleinfo',JSON.stringify([{"path":"/personalcenter"}]));
					store.dispatch('setdynamicrouter',null).then(()=>{
						this.moduleListActiveValue = "";
						setsessionstorage('moduleListActiveValue',"");
						this.$router.push('/personalcenter/personalinfo')
					})
        		}else if(name == "setting"){
        			//点击设置按钮后把上面4大模块的选择的值清空，避免页面刷新后还是原来的选中值
        			setsessionstorage('moduleListActiveValue',"");
        			var sendData = {
        				"roleId":getsessionstorage('roleid'),
						"menuId":this.settingBarMenu
        			}
        			var self = this;
	            	let url = api.apidomain+'/tqes/web/sysRes/getSideMenuInfo';
	            	this.$http.post(url,sendData).then(function(response) {
						if(response.data.success == true){
//							console.log(JSON.stringify(response.data.data.topMenuInfo))
							setsessionstorage('roleinfo',JSON.stringify(response.data.data.topMenuInfo));
							store.dispatch('setdynamicrouter',null).then(()=>{
								self.moduleListActiveValue = "";
								setsessionstorage('moduleListActiveValue',"");
								self.$router.push('/basicsetting/grademanagement')
							})
			           }else if(response.data.success == false){
			            		self.$Message.error({
									content: response.data.msg,
									duration: 10,
									closable: true
								});	
			            	}
			            	
						})
						.catch(function(error) {
							self.$Message.error({
								content: '系统发生错误：错误码00281',
								duration: 10,
								closable: true
							});
						});
        			
        		}
        		 
        	},
        	chooseRole:function(id){
        		console.log(id)
        		
        		var self = this;
            	let url = api.apidomain+'/tqes/web/login/getMenuInfoByChangeRole';
            	this.$http.post(url,{"roleId":id}).then(function(response) {
					if(response.data.success == true){
//						console.log(response.data.data)
						setsessionstorage('moduleListActiveValue',"");
						self.role = response.data.data.sysRoleName
						setsessionstorage('menuContainChild',JSON.stringify(response.data.data.menuContainChild));
						setsessionstorage('schoolName',response.data.data.schoolName);
						setsessionstorage('settingBarMenuInfo',JSON.stringify(response.data.data.settingBarMenuInfo));
						setsessionstorage('roleid',response.data.data.sysRoleId);
						setsessionstorage('toolBarMenuInfo',JSON.stringify(response.data.data.toolBarMenuInfo));
						setsessionstorage('roleinfo',JSON.stringify(response.data.data.topMenuInfo));
						
						store.dispatch('setdynamicrouter',null).then(()=>{
							
							self.getTopmenuButton()
//							self.referchangerouterlink();
//				        	self.slidemenu();
//				        	self.setusername();
//				        	self.getRoleList();
							self.$router.push(response.data.data.firstChildMenuPath)
						})
						
		           }else if(response.data.success == false){
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});	
		            	}
		            	
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00282',
							duration: 10,
							closable: true
						});
					});
        		
        	}
//      	openmenu:function(value){
//      		//console.log(value)
//      	}
        },
        updated:function(){
//      	//console.log('hhhhh')
        },
        watch:{
        	//页面回退后调整正确的侧边栏选项
        	'$route': function(newadd, oldadd) {
        		this.referchangerouterlink();
        	},
        	'dyrouter':function(newValue, oldValue){
//      		//console.log(newValue)
        		if(!newValue){
        			return;
        		}else{
        			this.slidemenu();
        		}
        	}
        }
    }
</script>

<style >
	    #app {
        font-family: 'Avenir', Helvetica, Arial, sans-serif;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-align: center;
        color: #2c3e50;
        /*margin-top: 60px;*/
    }
    
       .layout {
        /* border: 1px solid #d7dde4;*/
       
        background: #f5f7f9;
        position: relative;
        border-radius: 4px;
        /* overflow: hidden;*/
    }
    
       .layout-logo {
        width: 110px;
        height: 45px;
        background: #5b627000;
        border-radius: 3px;
        float: left;
        position: relative;
        top: 10px;
        left: 20px;
    }
    
       .layout-nav {
        width: 420px;
        margin: 0 auto;
        margin-right: 20px;
    }
    
       .ivu-layout-header {
        /*border-bottom: 2px solid green;*/
        background: #517EDB !important;
        padding: 0 !important;
        height: 68px !important;
    	line-height: 68px !important;
    }
       .ivu-layout-sider{
        background: #ffffff !important;
    }
       .ivu-menu-dark.ivu-menu-vertical .ivu-menu-opened{
    	background: #f0f0f0 !important;
    }
       .ivu-menu-dark{
    	background: #ffffff !important;
    }
    
    /*一级菜单栏文字颜色*/
       .ivu-menu-dark.ivu-menu-vertical .ivu-menu-item, .ivu-menu-dark.ivu-menu-vertical .ivu-menu-submenu-title{
	    color: #3A4152 !important;
    }
     /*一级菜单栏展开颜色*/
       .ivu-menu-dark.ivu-menu-vertical .ivu-menu-opened .ivu-menu-submenu-title{
    	background: #f0f2f5 !important;
    	color: #3A4152 !important;
    }
     /*一级菜单栏悬停的颜色*/
       .ivu-menu-dark.ivu-menu-vertical .ivu-menu-item:hover, .ivu-menu-dark.ivu-menu-vertical .ivu-menu-submenu-title:hover{
	    background: #f0f2f5 !important;
	    color: #3A4152 !important;
    }
    /*一级菜单栏选中背景颜色*/
       .ivu-menu-item-active {
    	background-color: #517EDB !important;
    }
    /*一级菜单栏选中字体颜色*/
    /*.ivu-menu-item-active span{
    	color: #f0f0f0 !important;
    }*/
    /*二级菜单栏选中的颜色*/
       .ivu-menu-dark.ivu-menu-vertical .ivu-menu-item-active:not(.ivu-menu-submenu), .ivu-menu-dark.ivu-menu-vertical .ivu-menu-submenu-title-active:not(.ivu-menu-submenu){
	    color: #f0f0f0 !important;
	    background-color: #517EDB !important;
    }
    /*二级菜单栏悬停的颜色*/
       .ivu-menu-dark.ivu-menu-vertical .ivu-menu-submenu .ivu-menu-item:hover{
    	color: #263b66 !important;
    	/*background: red !important;*/
    }
    
    
    /*.ivu-layout {
        background: #ffffff !important;
    }*/
       .ivu-menu-vertical .ivu-menu-item, .ivu-menu-vertical .ivu-menu-submenu-title{
    	padding: 14px 10px 14px 15px;
    }
       .ivu-menu-vertical.ivu-menu-light:after{
    	width: 0px !important;
    }
       .ivu-layout-footer{
    	padding:5px 50px !important;
    	background: #363e4f !important;
    }
       .ivu-menu-vertical .ivu-menu-submenu-title-icon{
    	left: -10px;
    }
       .ivu-menu-light.ivu-menu-vertical .ivu-menu-item-active:not(.ivu-menu-submenu){
    	color: white !important;
	    border-right: 2px solid red;
	    z-index: 2;
	    background-color: red;
    }
    
       .ivu-menu-vertical .ivu-menu-submenu .ivu-menu-item{
   		/*padding-left: 60px !important;*/
    }
       .ivu-icon-ios-arrow-down{
   		font-size: 23px;
	    font-weight: bold;
	    margin-top: -3px;
    }
       .moduleClass{
    	color: white;
    	margin-left: 80px;
    	font-size:14px;
    	display: inline-block;
    	height: 60px;
    }
       .moduleActive{
    	border-bottom: 4px solid white;
    }
</style>